import React, { Component } from "react"
import {View, Text, Image, StyleSheet, TouchableOpacity, AsyncStorage} from 'react-native'
import {BoxShadow} from 'react-native-shadow'
import {deviceWidth} from "../../../../util";

export default class Notice extends Component {

    render() {
        const shadowOpt = {
            width: deviceWidth - 32,
            height: 40,
            color:"#000",
            backgroundColor: '#000',
            border: 8,
            radius: 10,
            opacity: 0.1
        }
        return  (
                <View style={styles.notice}>
                    <BoxShadow setting={shadowOpt}>
                        <View style={{
                            backgroundColor: 'white',
                            borderBottomRightRadius: 10,
                            borderBottomLeftRadius: 10,
                            display: 'flex',
                            alignItems: 'center',
                            flexDirection: 'row',
                            paddingLeft: 15,
                            width: deviceWidth - 32,
                            height: 40
                        }}>
                            <Image source={require('src/assets/home/laba.png')}/>
                            <TouchableOpacity onPress={() => {
                                AsyncStorage.removeItem('token')
                                AsyncStorage.removeItem('currentUser')
                            }}>
                                <Text style={styles.text}>{this.props.notice}</Text>
                            </TouchableOpacity>
                        </View>
                    </BoxShadow>
                </View>
        )
    }
}

const styles = StyleSheet.create({
    notice: {
        paddingLeft: 16,
        paddingRight:  16,
        zIndex: -100
    },
    backgroundImage: {
        position: 'absolute',
        left: 0,
        right: 0,
        top: 0,
        bottom: 0,
        height: null,
        width: null,
        zIndex: -1
    },
    text: {
        paddingTop: 10,
        paddingBottom: 10,
        fontSize: 11,
        color: '#8E8E93',
        fontFamily: 'PingFang SC',
        marginLeft: 8
    }
})